require 'recon/config'
require 'test/unit'
require 'tempfile'

class TC_config < Test::Unit::TestCase

  def setup
    @testfile = Tempfile.new('recon.config')
    open( @testfile.path, 'w' ) {|f| f << Config::CONFIG.to_yaml }
  end
  
  def teardown
    @testfile.close
  end

  def test_create_and_save
    assert Config.new('/tmp/recon-test/t/e/s/t/test')
    FileUtils.rm_r '/tmp/recon-test'
    #assert_raise(Errno::EACCES, "you are root?"){ Config.new('/test/t/t/test') }
  end

  def test_load
    assert Config.new( @testfile.path )
  end

  def test_read
    open( @testfile.path ) {|f| @c = YAML.load(f.read) }
    assert_equal @c, Config::CONFIG
  end

end
